﻿<jsp:include page="header.jsp">
			<jsp:param value="item2" name="item"/>
</jsp:include> 
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<section class="content">
	<section class="widget"  id="department" >
		<header>
			<span class="icon">&#128196;</span>
			<hgroup>
				<h1>信息列表</h1>
				<h2>部门信息列表</h2>
			</hgroup>
		</header>
		<div class="content">
		
			<div>	
				<input type="button" id="addItem" class="button white" value="增加"/><br/><br/>			
				<s:if test="departmentList!=null && departmentList.size!=0">		
				<table  id="myTable">
			    	<tr>
			    		<th>部门号</th>
			    		<th>部门名</th>	
			    		<th>操作</th>	
			    	</tr>
			    	<s:iterator value="departmentList" id="row" status="state">
					    <tr>
					    <s:form action="updateDepartment" method="post">
					    	<td><input type="text" name="department.departmentId" readonly="readonly"  value=<s:property 
					    		value="#row.departmentId" />  maxlength="11" required="required"/></td>
					    	<td><input type="text" name="department.departmentName"  value=<s:property value="#row.departmentName"
					    		/>  maxlength="45" required="required"/></td>
					   		<td>
					   			<input type="submit" formaction="deleteDepartment" value="删除"  class="button white"/>
					   			<input type="submit" value="修改" class="button white"/>
					   		</td>
					   	</s:form>
					    </tr>
				    </s:iterator>
			    </table>
				</s:if>
				<s:else>
					<p>尚不存在部门！！</p><br/>
				</s:else>
					
				

			    <div id="popup" class="hide">
			    	<form id="reg-form" action="addDepartment" method="post">

				        <table>
							<tr>
								<td>部门号</td>
								<td><input name="department.departmentId" type="text" id="departmentId" maxlength="11" required="required"/>
								</td>
							</tr>
							<tr>
								<td>部门名</td>
								<td><input name="department.departmentName" type="text" id="departmentName"  maxlength="45" required="required"/></td>
							</tr>
						</table>

						<div class="buttons">
							<input value="完成" type="submit" class="button white">
							<input value="重置" type="reset" class="button white">
				        </div>
				    </form>
				</div>
			</div>
		</div>
	</section>
	<script type="text/javascript">

		var addItem = document.getElementById("addItem");
	
		//添加信息
		//添加信息
		addItem.onclick=function(){       
			 layer.open({
		        type: 1,
		        skin:'layui-layer-lan',
		        area: ['360px', '270px'],
		        shadeClose: true, //点击遮罩关闭
		        content: $('#popup')
		    });
		}
	    
	   
	    
	    var message="<%=request.getAttribute("message")%>";
		if(message!="null"){
			alert(message);
		}
	</script>
<%@ include file="footer.jsp" %>
